package com.ruoyi.oa.service.impl;

import java.util.List;

import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.oa.mapper.OaDocNumMapper;
import com.ruoyi.oa.domain.OaDocNum;
import com.ruoyi.oa.service.IOaDocNumService;

import javax.annotation.Resource;

/**
 * 单据编号Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-11-12
 */
@Service
public class OaDocNumServiceImpl implements IOaDocNumService 
{
    @Resource
    private OaDocNumMapper oaDocNumMapper;

    /**
     * 查询单据编号
     * 
     * @param docNum 单据编号主键
     * @return 单据编号
     */
    @Override
    public OaDocNum selectOaDocNumByDocNum(Long docNum)
    {
        return oaDocNumMapper.selectOaDocNumByDocNum(docNum);
    }

    /**
     * 查询单据编号列表
     * 
     * @param oaDocNum 单据编号
     * @return 单据编号
     */
    @Override
    public List<OaDocNum> selectOaDocNumList(OaDocNum oaDocNum)
    {
        return oaDocNumMapper.selectOaDocNumList(oaDocNum);
    }

    /**
     * 新增单据编号
     * 
     * @param oaDocNum 单据编号
     * @return 结果
     */
    @Override
    public int insertOaDocNum(OaDocNum oaDocNum)
    {
        oaDocNum.setCreateAt(DateUtils.getNowDate());
        oaDocNum.setCreateByUserId(SecurityUtils.getUserId());
        return oaDocNumMapper.insertOaDocNum(oaDocNum);
    }

    @Override
    public String newDocNum(OaDocNum oaDocNum)
    {
        return oaDocNumMapper.newDocNum(oaDocNum);
    }

    /**
     * 修改单据编号
     * 
     * @param oaDocNum 单据编号
     * @return 结果
     */
    @Override
    public int updateOaDocNum(OaDocNum oaDocNum)
    {
        return oaDocNumMapper.updateOaDocNum(oaDocNum);
    }

    /**
     * 批量删除单据编号
     * 
     * @param docNums 需要删除的单据编号主键
     * @return 结果
     */
    @Override
    public int deleteOaDocNumByDocNums(Long[] docNums)
    {
        return oaDocNumMapper.deleteOaDocNumByDocNums(docNums);
    }

    /**
     * 删除单据编号信息
     * 
     * @param docNum 单据编号主键
     * @return 结果
     */
    @Override
    public int deleteOaDocNumByDocNum(Long docNum)
    {
        return oaDocNumMapper.deleteOaDocNumByDocNum(docNum);
    }
}
